/*
 * @Author: songleiluo 361215740@qq.com
 * @Date: 2023-12-31 09:59:16
 * @LastEditors: songleiluo 361215740@qq.com
 * @LastEditTime: 2024-03-10 08:44:52
 * @FilePath: \hospital\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  hmr:true,
  host:'0.0.0.0',
  server: {
    proxy: {
      '/api': {
        target: 'http://121.199.28.233:8081', //目标url
        changeOrigin: true, //支持跨域
        rewrite: (path) => path.replace(/^\/api/, ""), 
          //重写路径,替换/api
      }
    }
  },
  //设置文件路径/src别名为@
  resolve:{
    alias:[
      {
        find: '@',
        replacement:resolve(__dirname,'./src')
      }
    ],
    extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"],
  },
})

